<template>
  <div class="home">
    <el-carousel :interval="4000" type="card" height="600px">
      <el-carousel-item v-for="(item, index) in carouselItems" :key="index">
        <div class="carousel-content" :style="{ backgroundImage: `url(${item.image})` }">
          <div class="carousel-text">
            <h2>{{ item.title }}</h2>
            <p>{{ item.description }}</p>
            <el-button type="primary" size="large" round @click="handleLearnMore(item)">
              了解更多
            </el-button>
          </div>
        </div>
      </el-carousel-item>
    </el-carousel>

    <div class="features">
      <el-row :gutter="40">
        <el-col :xs="24" :sm="8" v-for="(feature, index) in features" :key="index">
          <el-card class="feature-card" shadow="hover">
            <i :class="feature.icon"></i>
            <h3>{{ feature.title }}</h3>
            <p>{{ feature.description }}</p>
          </el-card>
        </el-col>
      </el-row>
    </div>
  </div>
</template>

<script>
export default {
  name: 'Home',
  data() {
    return {
      carouselItems: [
        {
          title: '创新科技',
          description: '引领行业发展，创造无限可能',
          image: 'https://picsum.photos/1920/1080?random=1',
          link: '/about'
        },
        {
          title: '专业团队',
          description: '汇聚精英，追求卓越',
          image: 'https://picsum.photos/1920/1080?random=2',
          link: '/jobs'
        },
        {
          title: '优质项目',
          description: '用心打造，品质保证',
          image: 'https://picsum.photos/1920/1080?random=3',
          link: '/portfolio'
        }
      ],
      features: [
        {
          icon: 'el-icon-star-on',
          title: '品质保证',
          description: '严格的质量管理体系，确保每个项目的完美交付'
        },
        {
          icon: 'el-icon-s-custom',
          title: '专业服务',
          description: '资深团队提供全方位的专业服务支持'
        },
        {
          icon: 'el-icon-s-promotion',
          title: '创新发展',
          description: '持续创新，引领行业发展方向'
        }
      ]
    }
  },
  methods: {
    handleLearnMore(item) {
      this.$router.push(item.link)
    }
  }
}
</script>

<style scoped>
.home {
  padding: 20px;
  overflow-x: hidden;
}

/* 轮播样式 */
.el-carousel {
  margin: 0 0 40px 0;
}

.el-carousel__item {
  border-radius: 8px;
}

.carousel-content {
  height: 100%;
  background-size: cover;
  background-position: center;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  text-align: center;
}

.carousel-text {
  background: rgba(0, 0, 0, 0.5);
  padding: 30px;
  border-radius: 8px;
  max-width: 80%;
}

.carousel-text h2 {
  font-size: 2.5em;
  margin-bottom: 20px;
}

.carousel-text p {
  font-size: 1.2em;
  margin-bottom: 30px;
}

/* 3D 轮播效果增强 */
.el-carousel__item--card {
  transform-style: preserve-3d;
  transition: transform 0.6s ease-in-out;
}

.el-carousel__item--card.is-active {
  transform: rotateY(0deg) translateZ(0);
}

.el-carousel__item--card:not(.is-active) {
  transform: rotateY(-45deg) translateZ(-200px);
}

/* 特性卡片样式 */
.features {
  margin-top: 40px;
}

.feature-card {
  text-align: center;
  padding: 20px;
  height: 100%;
  transition: transform 0.3s;
}

.feature-card:hover {
  transform: translateY(-5px);
}

.feature-card i {
  font-size: 3em;
  color: #409EFF;
  margin-bottom: 20px;
}

.feature-card h3 {
  margin: 15px 0;
  font-size: 1.5em;
}

/* 响应式调整 */
@media screen and (max-width: 768px) {
  .el-carousel {
    margin: 0 0 20px 0;
  }

  .carousel-text h2 {
    font-size: 1.8em;
  }

  .carousel-text p {
    font-size: 1em;
  }

  .features {
    margin-top: 20px;
  }

  .feature-card {
    margin-bottom: 20px;
  }
}
</style> 